package chixing.day19.demo;

public class ThreadDemo {
    public static void main(String[] args) {
        Thread daemonThread = new Thread(() -> {
            try {
                System.out.println("守护线程开始执行");
                Thread.sleep(3000);
                System.out.println("守护线程试图执行完毕");
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        });

        daemonThread.setDaemon(true); // 设置为守护线程
        daemonThread.start();

        System.out.println("主线程执行完毕");
    }
}
